/**
 * tjftp -- A simple FTP server, using the ANSI C
 * Copyright (C) 2011  degui.chen <degui.chen@qq.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef NOTIFY_H_
#define NOTIFY_H_
#include "lib/settings.h"
typedef void (*PLUGIN_INIT)(PSettings settings, int socket_fd);
typedef void (*PLUGIN_DESTORY)();

typedef void (*PLUGIN_LOOP_PRE)();
typedef void (*PLUGIN_LOOP_POST)();

typedef int (*PLUGIN_CONNECTION)(int accept_fd);
typedef void (*PLUGIN_DISCONNECT)(int accept_fd);

typedef void (*PLUGIN_RECEIVE)(char* buffer_recv);
typedef void (*PLUGIN_SEND)(char* buffer_recv);

typedef struct _PLUGIN_LIST PLUGIN_LIST, *PPLUGIN_LIST;
struct _PLUGIN_LIST {
	PLUGIN_INIT init;
	PLUGIN_DESTORY destory;
	PLUGIN_LOOP_PRE loop_pre;
	PLUGIN_LOOP_POST loop_post;
	PLUGIN_CONNECTION connects;
	PLUGIN_DISCONNECT disconnect;
	PLUGIN_RECEIVE receive;
	PLUGIN_SEND send;
	PPLUGIN_LIST next;
};

void tj_plugin_init(PSettings settings, int socket_fd);
void tj_plugin_destory();

void tj_plugin_loop_pre();
void tj_plugin_loop_post();

int tj_plugin_connects(int accept_fd);
void tj_plugin_disconnect(int accept_fd);

void tj_plugin_receive(char* buffer_recv);
void tj_plugin_send(char* buffer_recv);

#endif /* NOTIFY_H_ */
